package com.changpay.zywy.adapter

import android.content.Context
import android.graphics.Color
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.ruffian.library.widget.RView
import com.changpay.zywy.R
import com.changpay.zywy.bean.TotalActivationBean
import com.changpay.zywy.wight.WheelCircleView

/**
 * Created by chenxz on 2018/4/22.
 */
class ProducePresentAdapter(private val context: Context?, datas: MutableList<TotalActivationBean.ActivationBean>) :
    BaseQuickAdapter<TotalActivationBean.ActivationBean, BaseViewHolder>(R.layout.item_produce_present, datas) {

    override fun convert(helper: BaseViewHolder?, item: TotalActivationBean.ActivationBean?) {
        item ?: return
        helper ?: return
        helper.setText(R.id.tv_message, item.name + ": " + item.num.toString() + "台")
        when (item.type) {
            0 -> {
                helper.getView<RView>(R.id.v_colorview).helper.backgroundColorNormal = Color.parseColor("#ACD598")
                helper.getView<WheelCircleView>(R.id.ct_action_per).setOneCircleColor("#ACD598")
                helper.getView<WheelCircleView>(R.id.ct_action_per).setDataPer(item.num,item.total)
            }
            1 -> {
                helper.getView<RView>(R.id.v_colorview).helper.backgroundColorNormal = Color.parseColor("#F19EC2")
                helper.getView<WheelCircleView>(R.id.ct_action_per).setOneCircleColor("#F19EC2")
                helper.getView<WheelCircleView>(R.id.ct_action_per).setDataPer(item.num,item.total)

            }
            2 -> {
                helper.getView<RView>(R.id.v_colorview).helper.backgroundColorNormal = Color.parseColor("#F6B37F")
                helper.getView<WheelCircleView>(R.id.ct_action_per).setOneCircleColor("#F6B37F")
                helper.getView<WheelCircleView>(R.id.ct_action_per).setDataPer(item.num,item.total)

            }

            3 -> {
                helper.getView<RView>(R.id.v_colorview).helper.backgroundColorNormal = Color.parseColor("#84CCC9")
                helper.getView<WheelCircleView>(R.id.ct_action_per).setOneCircleColor("#84CCC9")
                helper.getView<WheelCircleView>(R.id.ct_action_per).setDataPer(item.num,item.total)

            }
        }
    }

}
